package org.drools.examples.banking;

import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;


public class BankingExample2 {       
    public static final void main(final String[] args) {         
        KieServices ks = KieServices.Factory.get();
        KieContainer kc = ks.getKieClasspathContainer();
        execute( kc );
    }
    public static void execute( KieContainer kc ) {
        KieSession ksession = kc.newKieSession("BankingExample2KS");  
        Number[] numbers = new Number[] {wrap(3), wrap(1), wrap(4), wrap(1), wrap(5)};
        
        for ( int i = 0; i < numbers.length; i++ ) {
            Object fact = numbers[i];
            System.out.println( "Inserting fact: " + fact );
            ksession.insert( fact );
        }        
               
        ksession.fireAllRules();
        ksession.dispose();
    }
    
    private static Integer wrap(int i) {
        return new Integer(i);
    }
}
